<?php 
require_once("connection/connect.php");
if(isset($_GET['id'])){
	$id = $_GET['id'];
	$rs = mysql_query("select district_id, name, provine_id from districts where provine_id = '$id'");
	echo "[";
	while($d = mysql_fetch_array($rs)){
		echo "{optionValue: ".$d['district_id'].",optionDisplay:'".$d['name']."'},";
	}
	echo "]";
}else if(isset($_GET['provine_id']) && isset($_GET['district_id'])){
 	$provine_id = $_GET['provine_id'];
	 $district_id = $_GET['district_id'];
	 $rs = mysql_query("select * from wards where district_id = $district_id and provine_id = $provine_id");
 	echo "[";
	while($d= mysql_fetch_array($rs)){
		echo "{optionValue: ".$d['ward_id'].",optionDisplay:'".$d['name']."'},";
	}
	echo "]";
}
?>